<?php
/**
 * 风景的控制器 *
 */ 
class ScenicAction extends HomeAction{
	/**
	 * 前台风景的列表
	 */
	public function index(){
		$Scenic = D('Scenic');
		$where = '1';
		$count=$Scenic->where($where)->count();
		$Page = new Page($count,C('PAGE_COUNT'));
		$limit = "{$Page->firstRow},{$Page->listRows}";
		$list = $Scenic->limit($limit)->select();
		foreach($list as &$v){
			$v['thumb'] = json_decode($v['picture_urls']);
			$v['thumb'] = $v['thumb'][0];
		}
		$this->assign('list',$list);
		
		$this->assign('page',$Page->show());
		$this->display();
	}
	/**
	 * 显示景点的详细
	 */
	public function view(){
		$id = intval($_GET['id']);
		$Scenic = M('Scenic');
		$scenic_info = $Scenic->where("id={$id}")->find();
		$ScenicImage = M('scenic_image');
		$images_list = json_decode($scenic_info['picture_urls']);
		$this->assign('scenic_info',$scenic_info);
		$this->assign('image_list',$images_list);
		$this->display();
	}
}
?>